package com.softeem.number;

import java.math.BigInteger;

/**
 * BigInteger:
 *  java中long类型为最大的整数类型,如果超过了long类型的数据我们应该怎么去表示
 *  byte
 *  short
 *  int
 *  long
 */
public class Big_01 {
    public static void main(String[] args) {
        System.out.println(Long.MAX_VALUE);//9223372036854775807
        System.out.println(Long.MIN_VALUE);//-9223372036854775808

        BigInteger big1 = new BigInteger("12345678909876543210123456789");
        BigInteger big2 = new BigInteger("12345678909876543210123456789");

        //加法
        BigInteger big3 = big1.add(big2);
        System.out.println(big3);//24691357819753086420246913578

        //减法
        BigInteger big4 = big3.subtract(big2);
        System.out.println(big4);//12345678909876543210123456789

        //乘法
        BigInteger big5 = big3.multiply(big1);
        System.out.println(big5);//304831575491540944651729919062947721844535893917500381042

        //除法
        BigInteger big6 = big5.divide(big3);
        System.out.println(big6);//12345678909876543210123456789

        float f = big5.floatValue();
        System.out.println(f);//Infinity



    }
}
